/*
    如果是get 要传 req.url
    如果是post 要传 path +? +chunk
*/
let getparam = function getparam(chunk,param){
    let url = "http://127.0.0.1:3001" + chunk
    let myurl = new URL(url)
    return myurl.searchParams.get(param)
}

/*
    api:
        请求路径
    info:
        输出信息

*/
let infolog = function infolog(api,info){
    let now = new Date();
    let year = now.getFullYear();
    let month = now.getMonth() + 1;
    let day = now.getDate();
    let hour = now.getHours();
    let minute = now.getMinutes();
    let second = now.getSeconds();
    let timeStr = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
    console.log("[" + timeStr + "]" + ":" +"请求地址:"+api+"\n"+"输出信息:"+ info);
}

module.exports = {
    getparam,
    infolog
}